﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.Plugins;
using System.Windows.Controls;
using System.Reflection;
using System.ComponentModel.Composition;
using RemoteTranslation.AssistentApplication.Services;
using RemoteTranslator.AssistentApplication.Plugins.ViewModels;
using YasharEl.Infrastructure.PresentationModel.MVVM;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using YasharEl.Infrastructure.Plugins.Administration;
using System.IO;

namespace RemoteTranslator.AssistentApplication.Plugins
{
    [UtilityPluginMetadata("RemoteTranslatorAssistentPlugin")]
    public class RemoteTranslatorAssistentPlugin : IUtilityPlugin
    {
        #region Fields

        private RemoteTranslatorAssistentUserControl _optionsUI = new RemoteTranslatorAssistentUserControl();
        private ITranslatorAssistent _translatorAssistent;
        private string _status;

        #endregion

        #region Constructors

        [ImportingConstructor]
        public RemoteTranslatorAssistentPlugin(ITranslatorAssistent translatorAssistent)
        {
            _translatorAssistent = translatorAssistent;
        }

        #endregion

        #region IUtilityPlugin Events

        public event EventHandler StatusUpdated;
        public event EventHandler<ShowMessageEventArgs> ShowMessage;

        #endregion

        #region IUtilityPlugin Properties

        public UserControl OptionsUserControl
        {
            get { return _optionsUI; }
        }

        public string Name
        {
            get { return "Remote Translator Assistent"; }
        }

        public Uri PluginIconUri
        {
            get
            {
                string path = "pack://application:,,,/RemoteTranslator.AssistentApplication.Plugins;component/Resources/RT_Assistent.png";
                return new Uri(path);
            }
        }

        public string Description
        {
            get { return "Remote Translator Assistent"; }
        }

        public string Author
        {
            get { return "Dmitry Khaymov"; }
        }

        public Version Version
        {
            get { return Assembly.GetExecutingAssembly().GetName().Version; }
        }

        public Uri AuthorUri
        {
            get { return new Uri("www.kab.co.il"); }
        }

        public Uri UpdateUri
        {
            get { return new Uri("www.kab.co.il\\plugins"); }
        }

        public string Status
        {
            get { return _status; }
            set
            {
                if (value != _status)
                {
                    _status = value;

                    if (StatusUpdated != null)
                        StatusUpdated(this, null);
                }
            }
        }

        #endregion

        #region IUtilityPlugin Methods

        public void Initialize()
        {
        }

        public void Start()
        {
            Status = "Started";
        }

        public void Stop()
        {
        }

        #endregion
    }
}
